<!DOCTYPE HTML>
<html>
<head>
<title>StringLower / StringUpper | AutoHotkey</title>
<meta name="description" content="The StringLower and StringUpper commands convert a string to lowercase or uppercase." />
<meta name="ahk:equiv-v2" content="commands/StrLower.htm" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<link href="../static/theme.css" rel="stylesheet" type="text/css" />
<script src="../static/content.js" type="text/javascript"></script>
<script type="text/javascript">$(function(){0<=window.navigator.userAgent.toLowerCase().indexOf("ucbrowser")&&CaoNiMaDeUc()})</script>
</head>
<body>

<h1>StringLower / StringUpper</h1>

<p>把字符串中的英文字母转换成小写或大写.</p>

<pre class="Syntax">
<span class="func">StringLower</span>, OutputVar, InputVar <span class="optional">, T</span>
<span class="func">StringUpper</span>, OutputVar, InputVar <span class="optional">, T</span>
</pre>
<h2 id="Parameters">参数</h2>
<dl>

  <dt>OutputVar</dt>
  <dd><p>用来存储新的转换后的字符串的变量名.</p></dd>

  <dt>InputVar</dt>
  <dd><p>需要被读取内容的变量名. 不要把名称括在百分号中, 除非您希望使用变量的 <em>内容</em> 作为被解析的变量名.</p></dd>

  <dt>T</dt>
  <dd><p>如果此参数为字母 T, 那么字符串会被转换为标题格式. 例如, "GONE with the WIND" 会被转换成 "Gone With The Wind".</p></dd>

</dl>

<h2 id="Remarks">备注</h2>
<p>要判断字符或字符串是否全部为大写或小写字母, 请使用 <a href="IfIs.htm">"if var is [not] upper/lower</a>".</p>
<p>在这个及其他所有命令中, <em>OutputVar</em> 和 <em>InputVar</em> 中可以使用相同的变量.</p>
<p><span class="ver">[v1.1.20+]:</span> <a href="Format.htm">Format()</a> 也能实现大小写变换, 如下所示:</p>
<pre>MsgBox % Format("{:U}, {:L} and {:T}", "upper", "LOWER", "title")</pre>

<h2 id="Related">相关</h2>
<p><a href="Format.htm">Format()</a>, <a href="IfInString.htm">IfInString</a>, <a href="StringGetPos.htm">StringGetPos</a>, <a href="StringMid.htm">StringMid</a>, <a href="StringTrimLeft.htm">StringTrimLeft</a>, <a href="StringTrimLeft.htm">StringTrimRight</a>, <a href="StringLeft.htm">StringLeft</a>, <a href="StringLeft.htm">StringRight</a>, <a href="StringLen.htm">StringLen</a>, <a href="StrReplace.htm">StrReplace()</a>, <a href="StringReplace.htm">StringReplace</a></p>
<h2 id="Examples">示例</h2>
<div class="ex" id="ExLower">
<p><a class="ex_number" href="#ExLower"></a> 转换字符串为小写并将 "this is a test." 存储在 <var>String1</var>.</p>
<pre>String1 := "This is a test."
StringLower, String1, String1  <em>; 即输出可以和输入一样.</em></pre>
</div>

<div class="ex" id="ExUpper">
<p><a class="ex_number" href="#ExUpper"></a> 转换字符串为大写并将 "THIS IS A TEST." 存储在 <var>String2</var>.</p>
<pre>String2 := "This is a test."
StringUpper, String2, String2</pre>
</div>

<div class="ex" id="ExTitle">
<p><a class="ex_number" href="#ExTitle"></a> 转换字符串为标题大写并将 "This Is A Test." 存储在 <var>String3</var>. 注意, 使用 StringLower 代替 StringUpper 也能达到同样的效果.</p>
<pre>String3 := "This is a test."
StringUpper, String3, String3, T</pre>
</div>

</body>
</html>